package com.example.elasticsearch.util;


import org.apache.commons.lang3.StringUtils;

import java.time.*;
import java.time.format.DateTimeFormatter;


public class DateTimeUtil {
    private static final String DEFAULT_DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
    private static final ZoneId ZONEID = ZoneId.systemDefault();

    private DateTimeUtil() {
    }

    public static LocalDateTime toLocalDateTime(String dateString) {
        return StringUtils.isBlank(dateString) ? null : LocalDateTime.parse(dateString, DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT));
    }

}

